﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThouShaltNotBrick.Logic.Resources;
using ThouShaltNotBrick.Logic.Helpers;

namespace ThouShaltNotBrick.Logic.GeneralObjects
{
    public sealed class PlayData
    {
        #region Properties
        #region Score
        /// <summary>
        /// Score property.
        /// </summary>
        public int Score { get; private set; }
        #endregion

        #region Lives
        /// <summary>
        /// Lives property.
        /// </summary>
        public int Lives { get; private set; }
        #endregion

        #region CurrentLevel
        /// <summary>
        /// CurrentLevel property.
        /// </summary>
        public LevelWithCurrentState CurrentLevel { get; private set; }
        #endregion

        private int mLevelIndex;
        private Campaign mCampaign;
        #endregion

        #region Constructors
        public PlayData(Campaign pCampaign)
        {
            mCampaign = pCampaign;
            Score = 0;
            Lives = Constants.INITIAL_LIVES;
            mLevelIndex = 0;
        }
        #endregion

        #region Methods
        public void NextLevel()
        {
            mLevelIndex++;
        }

        public void SetScore(int pScore)
        {
            Score = pScore;
        }

        public void ChangeScore(int pScoreChange)
        {
            Score += pScoreChange;
        }

        public void SetLives(int pLives)
        {
            Lives = pLives;
        }

        public void ChangeLives(int pLivesChange)
        {
            Lives += pLivesChange;
        }

        public void LoadCurrentLevel()
        {
            CurrentLevel = new LevelWithCurrentState(mCampaign.GetLevelByIndex(mLevelIndex));
        }
        #endregion
    }
}